Skip to content

Conversation

@L-series
Copy link
Contributor

@L-series L-series commented Dec 1, 2025

  • API: add failure mode support for randombytes()
  • autogen: run to update randombytes declaration
  • randombytes: add example to test failure

@L-series L-series requested a review from a team as a code owner December 1, 2025 22:01
@L-series L-series marked this pull request as draft December 1, 2025 23:04
@L-series L-series force-pushed the randombytes branch 3 times, most recently from 7733e4f to 6bbabfa Compare January 5, 2026 02:02
@L-series L-series marked this pull request as ready for review January 5, 2026 02:07
@hanno-becker
Copy link
Contributor

@L-series Do you need help debugging the CBMC and AWS-LC failures in CI, or are you fine investigating this?

@L-series L-series force-pushed the randombytes branch 4 times, most recently from e42d879 to 226364d Compare January 12, 2026 04:02
@L-series
Copy link
Contributor Author

Hi @hanno-becker, the CBMC proofs are fixed and the integration should now be on par with mldsa, however im still seeing an issue with the aws-lc tests after writing a post_import.patch file. Please let me know if you have any idea why the tests re failing.

@hanno-becker hanno-becker self-assigned this Jan 12, 2026
@hanno-becker hanno-becker self-requested a review January 12, 2026 05:57
-static MLK_INLINE void mlk_randombytes(void *ptr, size_t len) {
- RAND_bytes(ptr, len);
+static MLK_INLINE int mlk_randombytes(void *ptr, size_t len) {
+ return RAND_bytes(ptr, len);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at the source in AWS-LC https://github.com/aws/aws-lc/blob/8238483a40b413c56b6a4a1dc336a9cc83b1b21c/crypto/fipsmodule/rand/rand.c#L524 it looks like RAND_bytes returns 1 upon success.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! Edited the patch file to reflect this and now CI is passing.

Copy link
Contributor

@hanno-becker hanno-becker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The AWS-LC tests likely fail because RAND_bytes has a different error code convention.

@oqs-bot
Copy link
Contributor

oqs-bot commented Jan 18, 2026

CBMC Results (ML-KEM-512)

⚠️ Attention Required

Proof Status Current Previous Change
mlk_ntt_layer ⚠️ 30s 18s +67%
mlk_rej_uniform_c ⚠️ 103s 66s +56%
Full Results (139 proofs)
Proof Status Current Previous Change
mlk_indcpa_keypair_derand 225s 166s +36%
mlk_indcpa_enc 190s 168s +13%
mlk_keccak_squeezeblocks_x4 158s 121s +31%
mlk_rej_uniform_c ⚠️ 103s 66s +56%
mlk_polyvec_basemul_acc_montgomery_cached_c 56s 41s +37%
mlk_poly_rej_uniform 41s 33s +24%
poly_ntt_native 34s 23s +48%
mlk_ntt_layer ⚠️ 30s 18s +67%
polyvec_basemul_acc_montgomery_cached_native 25s 20s +25%
keccakf1600x4_permute_native_x4 20s 19s +5%
mlk_poly_reduce_native 17s 14s +21%
mlk_indcpa_dec 14s 9s +56%
mlk_ntt_butterfly_block 12s 9s +33%
mlk_poly_sub 12s 8s +50%
mlk_polyvec_add 11s 7s +57%
mlk_keccak_absorb_once_x4 10s 8s +25%
mlk_poly_frombytes_native 10s 7s +43%
mlk_keccak_squeezeblocks 9s 7s +29%
mlk_poly_rej_uniform_x4 9s 5s +80%
mlk_keccak_squeeze_once 8s 7s +14%
mlk_poly_frommsg 8s 7s +14%
kem_dec 6s 6s +0%
mlk_fqmul 6s 5s +20%
keccakf1600_permute_native 5s 5s +0%
mlk_invntt_layer 5s 4s +25%
mlk_keccak_absorb_once 5s 3s +67%
mlk_montgomery_reduce 5s 1s +400%
mlk_polymat_permute_bitrev_to_custom 5s 4s +25%
mlk_polyvec_mulcache_compute 5s 2s +150%
rej_uniform_native 5s 4s +25%
kem_check_pk 4s 2s +100%
mlk_check_pct 4s 3s +33%
mlk_keccakf1600_permute 4s 3s +33%
mlk_keccakf1600x4_extract_bytes 4s 2s +100%
mlk_poly_compress_du 4s 5s -20%
mlk_poly_frombytes_c 4s 2s +100%
mlk_poly_getnoise_eta1_4x 4s 3s +33%
mlk_poly_mulcache_compute_native 4s 4s +0%
mlk_poly_ntt 4s 3s +33%
mlk_poly_tomont 4s 1s +300%
mlk_polyvec_frombytes 4s 3s +33%
mlk_polyvec_permute_bitrev_to_custom 4s 2s +100%
poly_reduce_native_aarch64 4s 4s +0%
intt_native_aarch64 3s 3s +0%
keccak_f1600_x1_native_aarch64_v84a 3s 2s +50%
kem_check_sk 3s 1s +200%
kem_enc 3s 3s +0%
kem_enc_derand 3s 5s -40%
kem_keypair 3s 2s +50%
mlk_ct_cmask_nonzero_u16 3s 3s +0%
mlk_ct_cmov_zero 3s 2s +50%
mlk_ct_memcmp 3s 1s +200%
mlk_gen_matrix_serial 3s 2s +50%
mlk_keccakf1600x4_xor_bytes 3s 3s +0%
mlk_poly_cbd_eta2 3s 4s -25%
mlk_poly_getnoise_eta1122_4x 3s 5s -40%
mlk_poly_mulcache_compute 3s 3s +0%
mlk_poly_ntt_c 3s 3s +0%
mlk_poly_reduce_c 3s 2s +50%
mlk_poly_tomont_c 3s 3s +0%
mlk_poly_tomsg 3s 5s -40%
mlk_polyvec_invntt_tomont 3s 3s +0%
mlk_polyvec_permute_bitrev_to_custom_native 3s 2s +50%
mlk_scalar_compress_d1 3s 2s +50%
mlk_scalar_decompress_d11 3s 3s +0%
mlk_scalar_decompress_d5 3s 2s +50%
mlk_sha3_256 3s 2s +50%
mlk_shake256x4 3s 4s -25%
mlk_value_barrier_i32 3s 2s +50%
mlk_value_barrier_u32 3s 2s +50%
ntt_native_aarch64 3s 2s +50%
poly_tobytes_native_aarch64 3s 2s +50%
keccak_f1600_x4_native_aarch64_v84a 2s 1s +100%
keccak_f1600_x4_native_aarch64_v8a_v84a_scalar_hybrid 2s 2s +0%
kem_keypair_derand 2s 4s -50%
mlk_ct_cmask_neg_i16 2s 2s +0%
mlk_ct_cmask_nonzero_u8 2s 5s -60%
mlk_ct_get_optblocker_u32 2s 3s -33%
mlk_gen_matrix 2s 3s -33%
mlk_keccakf1600_extract_bytes (big endian) 2s 3s -33%
mlk_keccakf1600_xor_bytes (big endian) 2s 3s -33%
mlk_keccakf1600x4_permute 2s 3s -33%
mlk_matvec_mul 2s 2s +0%
mlk_poly_cbd_eta1 2s 4s -50%
mlk_poly_decompress_du 2s 2s +0%
mlk_poly_decompress_dv 2s 3s -33%
mlk_poly_getnoise_eta1_4x_native 2s 2s +0%
mlk_poly_getnoise_eta2 2s 2s +0%
mlk_poly_invntt_tomont 2s 3s -33%
mlk_poly_invntt_tomont_c 2s 2s +0%
mlk_poly_mulcache_compute_c 2s 3s -33%
mlk_poly_tobytes 2s 2s +0%
mlk_poly_tobytes_c 2s 2s +0%
mlk_poly_tomont_native 2s 1s +100%
mlk_polyvec_basemul_acc_montgomery_cached 2s 2s +0%
mlk_polyvec_decompress_du 2s 2s +0%
mlk_polyvec_reduce 2s 3s -33%
mlk_polyvec_tomont 2s 1s +100%
mlk_rej_uniform 2s 3s -33%
mlk_scalar_compress_d10 2s 2s +0%
mlk_scalar_compress_d4 2s 3s -33%
mlk_scalar_compress_d5 2s 2s +0%
mlk_scalar_decompress_d10 2s 2s +0%
mlk_scalar_decompress_d4 2s 3s -33%
mlk_scalar_signed_to_unsigned_q 2s 2s +0%
mlk_shake128_absorb_once 2s 1s +100%
mlk_shake128_squeezeblocks 2s 2s +0%
mlk_shake128x4_squeezeblocks 2s 1s +100%
mlk_value_barrier_u8 2s 3s -33%
poly_getnoise_eta1122_4x_native 2s 2s +0%
poly_invntt_tomont_native 2s 3s -33%
poly_tomont_native_aarch64 2s 4s -50%
polyvec_basemul_acc_montgomery_cached_k2_native_aarch64 2s 2s +0%
polyvec_basemul_acc_montgomery_cached_k3_native_aarch64 2s 4s -50%
polyvec_basemul_acc_montgomery_cached_k4_native_aarch64 2s 2s +0%
rej_uniform_native_aarch64 2s 1s +100%
sys_check_capability 2s 3s -33%
keccak_f1600_x1_native_aarch64 1s 2s -50%
keccak_f1600_x4_native_aarch64_v8a_scalar_hybrid 1s 3s -67%
mlk_barrett_reduce 1s 2s -50%
mlk_ct_get_optblocker_i32 1s 1s +0%
mlk_ct_get_optblocker_u8 1s 4s -75%
mlk_ct_sel_int16 1s 3s -67%
mlk_ct_sel_uint8 1s 6s -83%
mlk_keccakf1600_extract_bytes 1s 3s -67%
mlk_keccakf1600_xor_bytes 1s 2s -50%
mlk_poly_add 1s 3s -67%
mlk_poly_compress_dv 1s 1s +0%
mlk_poly_frombytes 1s 2s -50%
mlk_poly_reduce 1s 5s -80%
mlk_poly_tobytes_native 1s 1s +0%
mlk_polyvec_compress_du 1s 2s -50%
mlk_polyvec_ntt 1s 2s -50%
mlk_polyvec_tobytes 1s 2s -50%
mlk_scalar_compress_d11 1s 4s -75%
mlk_sha3_512 1s 2s -50%
mlk_shake128x4_absorb_once 1s 2s -50%
mlk_shake256 1s 3s -67%
poly_mulcache_compute_native_aarch64 1s 2s -50%

@oqs-bot
Copy link
Contributor

oqs-bot commented Jan 18, 2026

CBMC Results (ML-KEM-768)

Full Results (139 proofs)
Proof Status Current Previous Change
mlk_indcpa_enc 208s 224s -7%
mlk_indcpa_keypair_derand 161s 381s -58%
mlk_keccak_squeezeblocks_x4 125s 131s -5%
mlk_polyvec_basemul_acc_montgomery_cached_c 73s 76s -4%
mlk_rej_uniform_c 69s 82s -16%
polyvec_basemul_acc_montgomery_cached_native 53s 58s -9%
poly_ntt_native 39s 51s -24%
mlk_poly_rej_uniform 34s 41s -17%
mlk_indcpa_dec 21s 18s +17%
mlk_ntt_layer 21s 30s -30%
keccakf1600x4_permute_native_x4 18s 21s -14%
mlk_poly_reduce_native 15s 15s +0%
mlk_keccak_absorb_once_x4 11s 11s +0%
mlk_ntt_butterfly_block 10s 13s -23%
mlk_poly_sub 10s 11s -9%
mlk_polyvec_add 10s 9s +11%
mlk_keccak_squeeze_once 8s 6s +33%
mlk_poly_rej_uniform_x4 8s 7s +14%
mlk_polymat_permute_bitrev_to_custom 8s 6s +33%
mlk_fqmul 7s 6s +17%
mlk_poly_frombytes_native 7s 10s -30%
mlk_poly_frommsg 7s 6s +17%
keccakf1600_permute_native 6s 5s +20%
mlk_gen_matrix 6s 5s +20%
mlk_keccak_squeezeblocks 6s 7s -14%
kem_dec 5s 6s -17%
mlk_polyvec_frombytes 5s 1s +400%
kem_check_sk 4s 3s +33%
mlk_gen_matrix_serial 4s 5s -20%
mlk_invntt_layer 4s 5s -20%
mlk_keccak_absorb_once 4s 4s +0%
mlk_keccakf1600_extract_bytes 4s 2s +100%
mlk_keccakf1600_permute 4s 4s +0%
mlk_keccakf1600_xor_bytes (big endian) 4s 2s +100%
mlk_scalar_compress_d1 4s 1s +300%
poly_tobytes_native_aarch64 4s 1s +300%
intt_native_aarch64 3s 2s +50%
kem_check_pk 3s 4s -25%
mlk_barrett_reduce 3s 3s +0%
mlk_ct_get_optblocker_i32 3s 3s +0%
mlk_keccakf1600_extract_bytes (big endian) 3s 2s +50%
mlk_keccakf1600x4_xor_bytes 3s 3s +0%
mlk_matvec_mul 3s 3s +0%
mlk_poly_cbd_eta1 3s 4s -25%
mlk_poly_cbd_eta2 3s 1s +200%
mlk_poly_compress_dv 3s 4s -25%
mlk_poly_decompress_dv 3s 3s +0%
mlk_poly_getnoise_eta1_4x 3s 2s +50%
mlk_poly_getnoise_eta1_4x_native 3s 3s +0%
mlk_poly_invntt_tomont 3s 2s +50%
mlk_poly_reduce 3s 3s +0%
mlk_poly_reduce_c 3s 2s +50%
mlk_poly_tobytes_native 3s 1s +200%
mlk_poly_tomont_native 3s 2s +50%
mlk_polyvec_tomont 3s 1s +200%
mlk_rej_uniform 3s 1s +200%
mlk_scalar_compress_d10 3s 2s +50%
mlk_scalar_decompress_d11 3s 2s +50%
mlk_sha3_256 3s 4s -25%
mlk_shake256x4 3s 4s -25%
ntt_native_aarch64 3s 3s +0%
poly_getnoise_eta1122_4x_native 3s 2s +50%
poly_invntt_tomont_native 3s 1s +200%
poly_mulcache_compute_native_aarch64 3s 3s +0%
polyvec_basemul_acc_montgomery_cached_k2_native_aarch64 3s 4s -25%
polyvec_basemul_acc_montgomery_cached_k4_native_aarch64 3s 2s +50%
rej_uniform_native 3s 3s +0%
rej_uniform_native_aarch64 3s 3s +0%
sys_check_capability 3s 3s +0%
keccak_f1600_x4_native_aarch64_v84a 2s 1s +100%
keccak_f1600_x4_native_aarch64_v8a_v84a_scalar_hybrid 2s 1s +100%
kem_enc 2s 4s -50%
kem_enc_derand 2s 4s -50%
kem_keypair 2s 5s -60%
kem_keypair_derand 2s 3s -33%
mlk_check_pct 2s 5s -60%
mlk_ct_cmask_neg_i16 2s 4s -50%
mlk_ct_cmask_nonzero_u16 2s 1s +100%
mlk_ct_cmask_nonzero_u8 2s 1s +100%
mlk_ct_cmov_zero 2s 2s +0%
mlk_ct_get_optblocker_u32 2s 2s +0%
mlk_ct_memcmp 2s 3s -33%
mlk_ct_sel_int16 2s 1s +100%
mlk_ct_sel_uint8 2s 3s -33%
mlk_keccakf1600x4_permute 2s 2s +0%
mlk_poly_add 2s 2s +0%
mlk_poly_compress_du 2s 5s -60%
mlk_poly_frombytes 2s 2s +0%
mlk_poly_frombytes_c 2s 4s -50%
mlk_poly_getnoise_eta2 2s 2s +0%
mlk_poly_invntt_tomont_c 2s 1s +100%
mlk_poly_mulcache_compute 2s 2s +0%
mlk_poly_mulcache_compute_c 2s 4s -50%
mlk_poly_ntt 2s 3s -33%
mlk_poly_tobytes 2s 2s +0%
mlk_poly_tobytes_c 2s 2s +0%
mlk_poly_tomont 2s 4s -50%
mlk_poly_tomsg 2s 3s -33%
mlk_polyvec_basemul_acc_montgomery_cached 2s 2s +0%
mlk_polyvec_compress_du 2s 5s -60%
mlk_polyvec_decompress_du 2s 3s -33%
mlk_polyvec_mulcache_compute 2s 2s +0%
mlk_polyvec_ntt 2s 3s -33%
mlk_polyvec_permute_bitrev_to_custom 2s 3s -33%
mlk_polyvec_reduce 2s 1s +100%
mlk_polyvec_tobytes 2s 2s +0%
mlk_scalar_compress_d11 2s 2s +0%
mlk_scalar_compress_d4 2s 2s +0%
mlk_scalar_compress_d5 2s 3s -33%
mlk_scalar_decompress_d10 2s 2s +0%
mlk_scalar_decompress_d4 2s 1s +100%
mlk_scalar_signed_to_unsigned_q 2s 2s +0%
mlk_sha3_512 2s 3s -33%
mlk_shake128_absorb_once 2s 3s -33%
mlk_shake128_squeezeblocks 2s 3s -33%
mlk_shake128x4_absorb_once 2s 5s -60%
mlk_shake128x4_squeezeblocks 2s 2s +0%
mlk_shake256 2s 3s -33%
mlk_value_barrier_u32 2s 3s -33%
poly_tomont_native_aarch64 2s 2s +0%
polyvec_basemul_acc_montgomery_cached_k3_native_aarch64 2s 3s -33%
keccak_f1600_x1_native_aarch64 1s 2s -50%
keccak_f1600_x1_native_aarch64_v84a 1s 1s +0%
keccak_f1600_x4_native_aarch64_v8a_scalar_hybrid 1s 2s -50%
mlk_ct_get_optblocker_u8 1s 1s +0%
mlk_keccakf1600_xor_bytes 1s 3s -67%
mlk_keccakf1600x4_extract_bytes 1s 3s -67%
mlk_montgomery_reduce 1s 3s -67%
mlk_poly_decompress_du 1s 2s -50%
mlk_poly_getnoise_eta1122_4x 1s 3s -67%
mlk_poly_mulcache_compute_native 1s 3s -67%
mlk_poly_ntt_c 1s 3s -67%
mlk_poly_tomont_c 1s 1s +0%
mlk_polyvec_invntt_tomont 1s 2s -50%
mlk_polyvec_permute_bitrev_to_custom_native 1s 3s -67%
mlk_scalar_decompress_d5 1s 1s +0%
mlk_value_barrier_i32 1s 2s -50%
mlk_value_barrier_u8 1s 2s -50%
poly_reduce_native_aarch64 1s 3s -67%

@oqs-bot
Copy link
Contributor

oqs-bot commented Jan 18, 2026

CBMC Results (ML-KEM-1024)

⚠️ Attention Required

Proof Status Current Previous Change
mlk_indcpa_keypair_derand ⚠️ 725s 301s +141%
Full Results (139 proofs)
Proof Status Current Previous Change
mlk_indcpa_keypair_derand ⚠️ 725s 301s +141%
mlk_indcpa_enc 361s 396s -9%
mlk_keccak_squeezeblocks_x4 128s 152s -16%
mlk_polyvec_add 123s 141s -13%
polyvec_basemul_acc_montgomery_cached_native 116s 134s -13%
mlk_rej_uniform_c 78s 102s -24%
mlk_polyvec_basemul_acc_montgomery_cached_c 51s 68s -25%
poly_ntt_native 44s 54s -19%
mlk_poly_rej_uniform 40s 48s -17%
mlk_poly_decompress_dv 29s 44s -34%
mlk_ntt_layer 25s 37s -32%
keccakf1600x4_permute_native_x4 20s 22s -9%
mlk_indcpa_dec 17s 24s -29%
mlk_poly_reduce_native 14s 17s -18%
mlk_poly_sub 11s 11s +0%
mlk_gen_matrix 10s 9s +11%
mlk_keccak_absorb_once_x4 10s 13s -23%
mlk_ntt_butterfly_block 10s 12s -17%
mlk_keccak_squeeze_once 8s 9s -11%
mlk_poly_frombytes_native 7s 12s -42%
mlk_poly_frommsg 7s 8s -12%
mlk_poly_rej_uniform_x4 7s 8s -12%
mlk_gen_matrix_serial 6s 7s -14%
mlk_keccak_squeezeblocks 6s 7s -14%
mlk_shake128_absorb_once 6s 3s +100%
keccakf1600_permute_native 5s 7s -29%
kem_dec 5s 9s -44%
kem_keypair 5s 3s +67%
mlk_fqmul 5s 11s -55%
mlk_poly_compress_du 5s 7s -29%
mlk_polymat_permute_bitrev_to_custom 5s 6s -17%
intt_native_aarch64 4s 6s -33%
keccak_f1600_x1_native_aarch64 4s 3s +33%
keccak_f1600_x4_native_aarch64_v8a_scalar_hybrid 4s 3s +33%
kem_enc_derand 4s 4s +0%
mlk_invntt_layer 4s 6s -33%
mlk_keccak_absorb_once 4s 4s +0%
mlk_keccakf1600_permute 4s 1s +300%
mlk_poly_compress_dv 4s 2s +100%
mlk_poly_getnoise_eta1_4x_native 4s 3s +33%
mlk_poly_getnoise_eta2 4s 2s +100%
mlk_poly_mulcache_compute_c 4s 5s -20%
mlk_polyvec_ntt 4s 5s -20%
mlk_polyvec_permute_bitrev_to_custom_native 4s 4s +0%
mlk_polyvec_tomont 4s 3s +33%
poly_mulcache_compute_native_aarch64 4s 4s +0%
polyvec_basemul_acc_montgomery_cached_k3_native_aarch64 4s 2s +100%
kem_check_sk 3s 2s +50%
mlk_check_pct 3s 3s +0%
mlk_ct_cmask_nonzero_u16 3s 2s +50%
mlk_ct_sel_int16 3s 1s +200%
mlk_keccakf1600_extract_bytes 3s 2s +50%
mlk_keccakf1600x4_extract_bytes 3s 2s +50%
mlk_keccakf1600x4_xor_bytes 3s 3s +0%
mlk_matvec_mul 3s 2s +50%
mlk_poly_frombytes 3s 2s +50%
mlk_poly_getnoise_eta1122_4x 3s 2s +50%
mlk_poly_getnoise_eta1_4x 3s 4s -25%
mlk_poly_invntt_tomont 3s 2s +50%
mlk_poly_ntt_c 3s 1s +200%
mlk_poly_reduce 3s 2s +50%
mlk_poly_reduce_c 3s 4s -25%
mlk_poly_tomsg 3s 4s -25%
mlk_polyvec_compress_du 3s 2s +50%
mlk_polyvec_tobytes 3s 3s +0%
mlk_rej_uniform 3s 2s +50%
mlk_scalar_compress_d11 3s 1s +200%
mlk_scalar_compress_d5 3s 1s +200%
mlk_scalar_decompress_d5 3s 2s +50%
mlk_shake256 3s 2s +50%
mlk_shake256x4 3s 6s -50%
mlk_value_barrier_i32 3s 3s +0%
mlk_value_barrier_u32 3s 2s +50%
polyvec_basemul_acc_montgomery_cached_k2_native_aarch64 3s 6s -50%
polyvec_basemul_acc_montgomery_cached_k4_native_aarch64 3s 2s +50%
rej_uniform_native 3s 3s +0%
rej_uniform_native_aarch64 3s 3s +0%
keccak_f1600_x1_native_aarch64_v84a 2s 4s -50%
keccak_f1600_x4_native_aarch64_v84a 2s 3s -33%
kem_check_pk 2s 3s -33%
kem_enc 2s 2s +0%
kem_keypair_derand 2s 4s -50%
mlk_barrett_reduce 2s 1s +100%
mlk_ct_cmask_neg_i16 2s 2s +0%
mlk_ct_cmov_zero 2s 2s +0%
mlk_ct_get_optblocker_i32 2s 4s -50%
mlk_ct_get_optblocker_u32 2s 2s +0%
mlk_ct_memcmp 2s 5s -60%
mlk_ct_sel_uint8 2s 2s +0%
mlk_keccakf1600_extract_bytes (big endian) 2s 4s -50%
mlk_keccakf1600_xor_bytes 2s 4s -50%
mlk_keccakf1600x4_permute 2s 2s +0%
mlk_poly_cbd_eta1 2s 3s -33%
mlk_poly_cbd_eta2 2s 2s +0%
mlk_poly_decompress_du 2s 3s -33%
mlk_poly_frombytes_c 2s 2s +0%
mlk_poly_invntt_tomont_c 2s 3s -33%
mlk_poly_mulcache_compute 2s 2s +0%
mlk_poly_ntt 2s 4s -50%
mlk_poly_tobytes 2s 2s +0%
mlk_poly_tobytes_c 2s 3s -33%
mlk_poly_tobytes_native 2s 1s +100%
mlk_poly_tomont 2s 2s +0%
mlk_polyvec_basemul_acc_montgomery_cached 2s 1s +100%
mlk_polyvec_decompress_du 2s 3s -33%
mlk_polyvec_invntt_tomont 2s 2s +0%
mlk_polyvec_mulcache_compute 2s 5s -60%
mlk_polyvec_permute_bitrev_to_custom 2s 2s +0%
mlk_scalar_compress_d10 2s 2s +0%
mlk_scalar_compress_d4 2s 2s +0%
mlk_scalar_decompress_d10 2s 3s -33%
mlk_scalar_decompress_d4 2s 2s +0%
mlk_sha3_512 2s 2s +0%
mlk_shake128_squeezeblocks 2s 5s -60%
mlk_shake128x4_squeezeblocks 2s 2s +0%
mlk_value_barrier_u8 2s 2s +0%
ntt_native_aarch64 2s 2s +0%
poly_getnoise_eta1122_4x_native 2s 2s +0%
poly_invntt_tomont_native 2s 4s -50%
poly_reduce_native_aarch64 2s 3s -33%
poly_tobytes_native_aarch64 2s 4s -50%
poly_tomont_native_aarch64 2s 2s +0%
keccak_f1600_x4_native_aarch64_v8a_v84a_scalar_hybrid 1s 1s +0%
mlk_ct_cmask_nonzero_u8 1s 3s -67%
mlk_ct_get_optblocker_u8 1s 4s -75%
mlk_keccakf1600_xor_bytes (big endian) 1s 3s -67%
mlk_montgomery_reduce 1s 5s -80%
mlk_poly_add 1s 4s -75%
mlk_poly_mulcache_compute_native 1s 1s +0%
mlk_poly_tomont_c 1s 3s -67%
mlk_poly_tomont_native 1s 3s -67%
mlk_polyvec_frombytes 1s 4s -75%
mlk_polyvec_reduce 1s 2s -50%
mlk_scalar_compress_d1 1s 3s -67%
mlk_scalar_decompress_d11 1s 3s -67%
mlk_scalar_signed_to_unsigned_q 1s 2s -50%
mlk_sha3_256 1s 2s -50%
mlk_shake128x4_absorb_once 1s 3s -67%
sys_check_capability 1s 2s -50%

Change randombytes() to return int (0 on success, non-zero on failure)
instead of void, allowing callers to detect and handle RNG failures.

This commit:

* Updates function signatures.
* All call sites to check return values.
* Changes test files to use CHECK macro.
* Adds documentation of the new failure mode to sign.h and
  mlkem_native.h
* Adds a new error code MLK_ERR_RNG_FAIL.
* Declares src/randombytes with MLK_MUST_CHECK_RETURN_VALUE.

Signed-off-by: Andreas Hatziiliou <[email protected]>
Tests that crypto_kem_enc and crypto_kem_keypair,
correctly return MLD_ERR_RNG_FAIL when randombytes()
fails. We systematically inject failures at each
invocation point. This test is based off the work from
the test_alloc implementation.

Signed-off-by: Andreas Hatziiliou <[email protected]>
Add the rng failure test to the CI.

Signed-off-by: Andreas Hatziiliou <[email protected]>
@hanno-becker
Copy link
Contributor

@L-series could you also incorporate pq-code-package/mldsa-native#864 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants